<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .btn{
            color: #333;
            background-color: #fff;
            border-color: #ccc;
            display: inline-block;
            margin-bottom: 0;
            font-weight: 400;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            -ms-touch-action: manipulation;
            touch-action: manipulation;
            cursor: pointer;
            background-image: none;
            border: 1px solid #ccc;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            border-radius: 4px;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        .btn.danger{
            background: rgb(211, 24, 24);
            color: white;
        }

        .btn.primary{
            background: rgb(37, 116, 233);
            color: white;
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        /*
            名字:  Button
            属性:  type   
                    type="primary"  蓝色
                    type="danger"   红色

            <Button type="danger">测试按钮</Button>
        */

        class Button extends React.Component{
            render(){
                return <button className={"btn " + (this.props.type ? this.props.type : '')}>{this.props.children}</button>
            }
        }

        class App extends React.Component{
            render(){
                return <Button type="primary">测试文本ABC</Button>
            }
        }

        ReactDOM.render(<App />, document.querySelector("#root"));
    </script>
</body>
</html>